Skip to content

fix(sonarcloud): declare all supported Python versions to Sonar - #61

Open
williaby wants to merge 1 commit into
mainfrom
claude/sonar-python-version-0
Open

fix(sonarcloud): declare all supported Python versions to Sonar#61
williaby wants to merge 1 commit into
mainfrom
claude/sonar-python-version-0

Conversation

@williaby

@williaby williaby commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Problem

sonar.python.version was 3.12, the single version CI builds with, while this project's
requires-python is ">=3.10,<3.15".

SonarPython gates version-specific rules on all declared versions:
PythonVersionUtils.areSourcePythonVersionsGreaterOrEqualThan is an allMatch. Declaring
only 3.12 therefore satisfies every >= 3.11 and >= 3.12 gate, so those rules fire
against code that must still run on 3.10.

Preventive, not curative

SonarCloud reports 0 open S6794/S6796 issues here today. The misconfiguration is real
but latent: it fires the first time this codebase grows a construct one of those rules covers,
such as a PEP 695 type X = ... alias, and then reports a finding the project cannot act on
without dropping 3.10 support. Flagging this so a green result is not read as evidence the
change was unnecessary.

Fix

sonar-python-version: '3.10,3.11,3.12,3.13,3.14'

3.14 joined the org supported set in ByronWilliamsCPA/.github#292, and requires-python's
<3.15 ceiling admits it.

python-version stays 3.12. It feeds actions/setup-python and is the version the project
builds and tests with, a separate concern from the versions the source must remain compatible
with. Conflating the two is what caused this.

Why the pin moves too

sonar-python-version is new in ByronWilliamsCPA/.github#291 and does not exist in the
previously pinned revision. Passing an input the callee does not declare fails a reusable
workflow at startup, so the pin moves to 4bd2d7c, the squash commit of #291 on main.

Also in this change

sonar-project.properties is synced to the same list. CI overrides it via -D, but SonarLint
in the IDE reads it, so leaving it at 3.12 would keep local analysis raising what CI does
not.

Verification

  • actionlint rc=0
  • pre-commit scoped to the two changed files: every matching hook passes
  • Only the two SonarCloud files are staged; nothing else in the tree is touched

Summary by CodeRabbit

  • Chores
    • Updated code quality analysis to evaluate compatibility across Python 3.10–3.14.
    • Aligned analysis settings with the project’s supported Python versions.
    • Improved CI configuration documentation for Python version overrides.

sonar.python.version was 3.12, the single version CI builds with, while
requires-python is ">=3.10,<3.15". SonarPython gates version-specific rules on
ALL declared versions (PythonVersionUtils.areSourcePythonVersionsGreaterOrEqualThan
is allMatch), so declaring only 3.12 satisfies every >=3.11 and >=3.12 gate and
raises those rules against code that must still run on 3.10.

No S6794/S6796 issue is open in SonarCloud today, so this is preventive: the
misconfiguration fires the first time this codebase grows a construct one of those
rules covers, and then reports something the project cannot act on without
dropping 3.10.

Sets the new sonar-python-version input (ByronWilliamsCPA/.github#291) and bumps
the uses: pin to the commit that introduces it, since passing an input the callee
does not declare fails a reusable workflow at startup.

Also syncs sonar-project.properties, which CI overrides via -D but SonarLint in
the IDE reads.

python-version stays 3.12: it feeds actions/setup-python and is a separate concern
from the versions the source must remain compatible with.

Verified: actionlint rc=0; pre-commit scoped to the two changed files passes every
hook that matches them.
Copilot AI lite review requested due to automatic review settings August 6, 2026 04:09
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

SonarCloud configuration now analyzes Python 3.10 through 3.14. The reusable workflow reference was updated, and comments document CI override behavior.

Changes

SonarCloud version alignment

Layer / File(s) Summary
Configure SonarCloud analysis versions
.github/workflows/sonarcloud.yml, sonar-project.properties
The workflow and project configuration specify Python 3.10 through 3.14 for SonarCloud analysis. The project configuration documents CI overrides and local SonarLint usage.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested labels: ci

Suggested reviewers: byronwilliamscpa, copilot

Poem

A rabbit checks each Python line,
From three-ten through three-fourteen fine.
Sonar hops through every gate,
While CI keeps its version straight.

(\_/)
(•_•)
/ >🍃
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: declaring all supported Python versions in SonarCloud configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/sonar-python-version-0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns SonarCloud/SonarLint Python version configuration with the project’s declared compatibility range (requires-python = ">=3.10,<3.15"), so version-gated SonarPython rules don’t incorrectly assume 3.11+/3.12+ features are always allowed when the code must still run on 3.10.

Changes:

  • Updates sonar.python.version to declare all supported source versions (3.10–3.14) for local/IDE (SonarLint) analysis.
  • Updates the SonarCloud reusable workflow pin and passes sonar-python-version so CI analysis uses the same supported-version set.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
sonar-project.properties Sets sonar.python.version to 3.10–3.14 and documents that this should stay in sync with CI/IDE analysis expectations.
.github/workflows/sonarcloud.yml Bumps reusable workflow ref and supplies sonar-python-version with the full supported-version list.

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sonar-project.properties`:
- Around line 26-29: Update the comment above sonar.python.version in
sonar-project.properties to remove the claim that this setting affects local or
IDE SonarLint analysis. Keep the explanation that CI overrides the value and
that the supported Python-version range must remain aligned with
requires-python.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 88d73005-7919-4bd3-8b51-d11675766d44

📥 Commits

Reviewing files that changed from the base of the PR and between e3ea1fc and cfd9a46.

📒 Files selected for processing (2)
  • .github/workflows/sonarcloud.yml
  • sonar-project.properties

Comment thread sonar-project.properties
Comment on lines +26 to +29
# Versions the SOURCE supports, matching requires-python (">=3.10,<3.15"). CI overrides this
# via -Dsonar.python.version from the sonar-python-version input, so this key only affects
# local and IDE (SonarLint) analysis. Keep the two in sync.
sonar.python.version=3.10,3.11,3.12,3.13,3.14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n --hidden --glob '!**/.git/**' \
  'sonar\.python\.version|sonarlint|sonarqube' .

Repository: ByronWilliamsCPA/python-libs

Length of output: 683


🌐 Web query:

SonarQube for IDE sonar-project.properties properties applied sonarlint sonar.python.version

💡 Result:

SonarLint for IDEs does not directly use the sonar-project.properties file to configure analysis parameters like sonar.python.version [1][2][3]. The sonar-project.properties file is designed specifically for SonarScanner CLI, which is used for full server-side analysis [1][3]. In SonarLint, the recommended way to manage configuration is through Connected Mode [4]. When you bind your IDE project to a project in SonarQube or SonarCloud, SonarLint retrieves the configuration (including quality profiles and rules) directly from the server [4][3]. This ensures that your IDE analysis remains consistent with the server-side analysis [3]. Regarding sonar.python.version specifically: - Purpose: This parameter informs the Python analyzer about the expected Python version to improve the accuracy of the analysis (e.g., standard library handling and symbol resolution) [5][6][7]. - Usage: It is intended for use in sonar-project.properties or via SonarScanner CLI during full analysis [6][8][9]. - SonarLint Behavior: SonarLint does not read this property from local configuration files [3]. If you are using Connected Mode, the server-side configuration should ideally handle the environment settings [3]. If you are not in Connected Mode, SonarLint relies on its internal default settings and does not currently support local overrides of this parameter via property files [1][2]. If you need to ensure consistency between your IDE and your CI analysis, the best practice is to ensure your project is properly bound in Connected Mode to your SonarQube/SonarCloud instance [4][3].

Citations:


🌐 Web query:

SonarLint Python 3.14 Sonar rule Python version support sonar.python.version

💡 Result:

SonarLint and the broader Sonar ecosystem (including SonarQube Server and SonarQube Cloud) provide full support for Python 3.14 [1][2][3]. The support for Python 3.14 was introduced to enable analysis of new language features, including specific rules (such as S7931, S7941, S7942, S7943, and S7945) designed to ensure best practices when using Python 3.14 capabilities [4]. Regarding configuration, you can use the sonar.python.version parameter to specify the Python version(s) your project supports [1][3][5]. This helps the analyzer provide more precise results and silence irrelevant issues [1][6]. Key details for sonar.python.version: - Purpose: It allows you to define which Python versions are compatible with your code, ensuring the analysis is tailored to the correct language features [1][3]. - Format: It accepts a comma-separated list of versions in the "X.Y" format (e.g., sonar.python.version=3.13, 3.14) [1][5][7]. - Usage: This parameter can be set in your sonar-project.properties file or provided via the CLI during analysis [1][5][6]. For IDE integration, including SonarLint, ensure your plugin is updated to the latest version to access the most recent rules and support for Python 3.14 [4].

Citations:


Remove the SonarLint sonar-project.properties claim.

sonar-project.properties is for SonarScanner runs, and SonarLint does not apply sonar.python.version from this file. Keep the CI value aligned, but remove “affects local and IDE (SonarLint) analysis” or document a supported connected-mode/IDE configuration instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sonar-project.properties` around lines 26 - 29, Update the comment above
sonar.python.version in sonar-project.properties to remove the claim that this
setting affects local or IDE SonarLint analysis. Keep the explanation that CI
overrides the value and that the supported Python-version range must remain
aligned with requires-python.

@williaby
williaby enabled auto-merge September 3, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants